const BASE_URL = 'http://192.168.30.8:8800/'
// const BASE_URL = 'http://192.168.101.90:8800/'

export const myRequest = (options) => {
	const header_tmp = {
		"Authorization": "Bearer"+ " " + uni.getStorageSync("_token") || ''
	};
	console.log(options);
	return new Promise((resolve,reject)=>{
		uni.request({
			url: BASE_URL + options.url,
			method: options.method || 'post',
			data: options.data || {},
			header: header_tmp,
			success: (res) => {
				options.success(res);
				// 异常
				if(res.data.code == 1){
					return uni.showToast({
						title: res.data.msg,
						position: "bottom"
					})
				} 
				resolve(res)
			},
			fail: (err) => {
				return uni.showToast({
					title: "服务异常",
					position: "bottom"
				})
				reject(err)
			}
		})
	})
}